package com.mashibing.juc.c_001;

/**
 * @ClassName T03_Synchronized
 * @Description synchronized关键字，加锁
 * @Author xiongwei.wu
 * @Date 2021/6/30 16:38
 **/
public class T04_Synchronized {
    private static int count = 10;

    public synchronized static void m() {
        //这里等同于synchronized(T04_Synchronized.class);
        count--;
        System.out.println(Thread.currentThread().getName() + " count = " + count);
    }

    public static void mm() {
        //考虑一下这里写T04_Synchronized.this是否可以？
        synchronized (T04_Synchronized.class) {
            count--;
        }
    }
}
